<?php
namespace Club\Model;
use Think\Model;
class CustomizedTravelModel extends Model {    
    /**
     * model的中文名称
     */
    public $modelName = '定制旅行';

    /**
     * model的icon
     */
    public $modelIcon = 'icon-edit';
    protected $_auto = [
        ["create_time", "strtotime", 3, "function"],
        ["update_time", "strtotime", 3, "function"],
        ["create_time", "time", 1, "function"],
        ["update_time", "time", 2, "function"],
    ];
    protected $_validate = [
        ["id", "require", "ID必须填写!"],
        ["user_id", "require", "购买者必须填写!"],
        ["name", "require", "姓名必须填写!"],
        ["phone", "require", "电话必须填写!"],
        ["region_id", "require", "目的地必须填写!"],
        ["type", "require", "类型必须填写!"],
        ["state", "require", "状态[待处理,已处理]必须填写!"],
        ["create_time", "require", "创建时间必须填写!"],
        ["update_time", "require", "更新时间必须填写!"],
    ];
    public $excel = false;
    public $delete = false;
    public $update = false;
    public $fieldMap = [
        "id"=>[
            "type"=>"input",
            "name"=>"ID",
            "list"=>true,
            "search"=>true,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "user_id"=>[
            "type"=>"foreign",
            "name"=>"购买者",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"user,id,name,input",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "phone"=>[
            "type"=>"foreign",
            "name"=>"电话",
            "list"=>true,
            "search"=>false,
            "input"=>false,
            "required"=>false,
            "detail"=>true,
            "excel"=>true,
            "content"=>"user,id,username,input",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "transaction_type"=>[
            "type"=>"select",
            "name"=>"交易类型",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"定制,购买",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],

        "name"=>[
            "type"=>"input",
            "name"=>"姓名",
            "list"=>true,
            "search"=>true,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "phone"=>[
            "type"=>"input",
            "name"=>"电话",
            "list"=>false,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>false,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "region_id"=>[
            "type"=>"foreign",
            "name"=>"目的地",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"region,id,name,select",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "type"=>[
            "type"=>"foreign",
            "name"=>"类型",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"funding_type,id,long_name,select",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "state"=>[
            "type"=>"select",
            "name"=>"状态",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"待处理,已处理",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "num"=>[
            "type"=>"input",
            "name"=>"人数",
            "list"=>true,
            "search"=>false,
            "input"=>false,
            "required"=>false,
            "detail"=>false,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>'<td class="center">
        {:D("TouristOrder")->where(["order_type"=>"customized_travel", "order_id"=>$vo["id"]])->count()}
            </td>',
            "update_specify"=>"",
            "detail_specify"=>"",
        ],

        "create_time"=>[
            "type"=>"datetime",
            "name"=>"创建时间",
            "list"=>true,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "update_time"=>[
            "type"=>"datetime",
            "name"=>"更新时间",
            "list"=>false,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "insurance"=>[
            "type"=>"input",
            "name"=>"保险",
            "list"=>true,
            "search"=>false,
            "input"=>false,
            "required"=>false,
            "detail"=>false,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>'<td class="center"><a href="__MODULE__/InsuranceOrder/list?searchMap[order_type]=customized_travel&searchMap[order_id]={$vo[\'id\']}">点击查看</a></td>',
            "update_specify"=>"",
            "detail_specify"=>"",
        ],

    ];
}